/*
 * @Author: doing
 * @Date: 2023-09-07 19:34:10
 * @LastEditors: git config user.name && git config user.email
 * @LastEditTime: 2023-09-16 21:51:11
 * @FilePath: \水果新鲜识别项目\web-admin\src\api\menu.js
 * @Description: 
 * 所有菜单权限
 * Copyright (c) 2023 by 1540265624@qq.com, All Rights Reserved. 
 */
import axios from '~/axios.js'

//获取菜单树
function getMenuTree() {
    return axios.get('/v1/menu/tree')
}

//添加菜单
function addMenu(body) {
    return axios.post('/v1/menu/create', body)
}

//更新菜单
function updateMenu(body) {
    return axios.put('/v1/menu/edit', body)
}


//删除菜单
function deleteMenu(id) {
    return axios.delete(`/v1/menu/del?id=${id}`)
}

//根据角色获取菜单ids
function getMenuIdByRole(id){
    return axios.get(`/v1/menu/getMenuIdByRole?roleId=${id}`)
}

export default {
    getMenuTree,
    addMenu,
    updateMenu,
    deleteMenu,
    getMenuIdByRole
}